import { defineConfig } from 'vite'
import { resolve,dirname } from 'path'
import {fileURLToPath} from 'url'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename);

export default defineConfig({
  root: './src/pages',
  plugins: [],
  base:'/',
  build: {
    emptyOutDir:true,
    outDir: '../../dist',
    rollupOptions: {
      input: {
        index: resolve(__dirname, './src/pages/index/index.html'),
        about: resolve(__dirname, './src/pages/about/index.html'),
      },
      output:{
        entryFileNames: 'js/[name].js', // 输出的文件名
        chunkFileNames: 'shared/[name].js', // 输出的文件名
        assetFileNames: 'assets/[name].[ext]', // 输出的文件名
      }
    }
  },
  server: {
    open: '/index/index.html', // 开发服务器启动时打开的页面
  }
})